package noobteam.deartrainer.service;

import noobteam.deartrainer.mapper.BudgetInfoMapper;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * @author 徐紫印
 */
@Service
public class BudgetInfoService {

    @Resource
    private BudgetInfoMapper budgetInfoMapper;

    public boolean createBudget(Map<String, Object> budget){
        boolean isSucceed = false;
        try {
            isSucceed = budgetInfoMapper.createBudget(budget);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return isSucceed;
    }

    public List<Map<String, Object>> getBudgetInfo(Integer userId){
        List<Map<String, Object>> list = null;
        try {
            list = budgetInfoMapper.getBudgetInfoById(userId);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return list;
    }
}
